package com.apes.enquiry.enquiry.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.plugin.fileserver.File;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 类描述：询价需求
 *
 * @ClassName EnquiryRequire
 * @Description 描述
 * @Author wushilong
 * @Date 2023/3/15 16:50
 * @Version 1.0
 */

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = EnquiryRequire.CONST_TABLE_NAME)
public class EnquiryRequire extends BaseModel {

    public static final String CONST_TABLE_NAME = "sp_mas_enquiry_require";

    @Id
    @Column(name = "id", length = 10)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "询价需求", padding = 8)
    @Comment("编码")
    private String id;

    @Column(name = "enquiry_id", length = 32, nullable = false)
    @Comment("询价单号")
    private String enquiryId;

    @Column(name = "note")
    @Comment("备注")
    private String note;

    @Column(name = "describe")
    @Comment("描述")
    private String describe;

    @Column(name = "qty")
    @Comment("数量")
    private Integer qty;

    @File
    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "old_picture", columnDefinition = "CLOB")
    @Comment("旧件图片")
    private String oldPicture;

    @Column(name = "state")
    @Comment("状态")
    private String state;//ing(待编译), already(已编译), cannot(无法编译)
}
